package com.qf.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;

/**
 * @author sky
 * @date 2022-08-19
 */
public class DateUtil {

        private static final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

        //字符串转Util
        public static java.util.Date strToUtilDate(String str) {
            try {
                return simpleDateFormat.parse(str);
            } catch (ParseException e) {
                e.printStackTrace();
            }
            return null;
        }
        //util转sql
        public static java.sql.Date utilToSql(java.util.Date date){
            return new java.sql.Date(date.getTime());
        }

        //util转字符串
        public static String toStr(java.util.Date bornDate){
            return simpleDateFormat.format(bornDate);
        }


}
